package Creature;

import Item.Item;

import java.util.ArrayList;

public class Player {
    int health;
    int power;
    int san;
    int money;
    int hungry;
    int fatigue; //疲劳
    int charm; //魅力

    boolean isCOVID;
    public ArrayList<Item> itemList;
    public ArrayList<Food> foods;

    /**
     * 属性满值为100,初始资金500,值都是越高越好，属性的不同会影响事件的判断结果
     */
    public Player(){
        money=600;
        san=90;
        health=90;
        //武力值
        power=60;


        hungry=90;
        //疲劳
        fatigue=80;
        //魅力
        charm=60;

        itemList=new ArrayList<>();
        foods=new ArrayList<>();
    }

    public void setHealth(int a) {
        health = Math.max(a, 0);
    }
    public void setCharm(int a){charm = Math.max(a,0);}

    public int getCharm(){return charm;}

    public void setPower(int a) {
        power = Math.max(a, 0);
    }

    public void setSan(int a) {
        san = Math.max(a, 0);
    }

    public void setMoney(int a) {
        money = Math.max(a, 0);
    }

    public void setHungry(int a) {
        hungry = Math.max(a, 0);
    }

    public void setFatigue(int a) {
        fatigue = a;
    }

    public int getHealth() {
        return health;
    }

    public int getPower() {
        return power;
    }

    public int getSan() {
        return san;
    }

    public int getMoney() {
        return money;
    }

    public int getHungry() {
        return hungry;
    }

    public int getFatigue() {
        return fatigue;
    }

    public boolean isHungry() {
        return hungry <= 50;
    }

    public boolean isFatigue() {
        return fatigue <= 40;
    }

    public boolean isSick() {
        return health <= 60;
    }

    public void  setCOVID(boolean c){
        isCOVID=c;
    }
    public boolean isCOVID(){
        return isCOVID;
    }


    public String sickType() {
        if (health <= 20) {
            return "COVID";
        } else if (health <= 40) {
            return "发烧";
        } else if (isSick()) {
            return "感冒";
        } else {
            return "健康";
        }
    }

    public void getItem(Item item) {
        itemList.add(item);
    }

    public void getFood(Food food) {
        foods.add(food);
    }
}